package com.work.yshop.model;

import android.os.Parcel;
import android.os.Parcelable;

public class Message implements Parcelable {
    private int id;
    private String title;
    private String content;
    private String time;
    private String imageUrl;
    private boolean isUnread;

    public Message(int id, String title, String content, String time, String imageUrl, boolean isUnread) {
        this.id = id;
        this.title = title;
        this.content = content;
        this.time = time;
        this.imageUrl = imageUrl;
        this.isUnread = isUnread;
    }

    protected Message(Parcel in) {
        id = in.readInt();
        title = in.readString();
        content = in.readString();
        time = in.readString();
        imageUrl = in.readString();
        isUnread = in.readByte() != 0;
    }

    public static final Creator<Message> CREATOR = new Creator<Message>() {
        @Override
        public Message createFromParcel(Parcel in) {
            return new Message(in);
        }

        @Override
        public Message[] newArray(int size) {
            return new Message[size];
        }
    };

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSender() {
        return title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public boolean isUnread() {
        return isUnread;
    }

    public void setUnread(boolean unread) {
        isUnread = unread;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(id);
        dest.writeString(title);
        dest.writeString(content);
        dest.writeString(time);
        dest.writeString(imageUrl);
        dest.writeByte((byte) (isUnread ? 1 : 0));
    }
} 